<template>
  <div class="toast" v-show="isShow">
    <div class="symbol">
      <svg class="icon" aria-hidden="true">
        <use xlink:href="#icon-right1" />
      </svg>
    </div>
    <div class="i2">{{message}}</div>
  </div>
</template>
<script>
import iconFont from "common/iconfont";
export default {
  name: "Toast",

  data() {
    return {
      message: "",
      isShow: false
    };
  },
  methods: {
    show(message = "添加了新的商品", duration = 1500) {
      this.isShow = true;
      this.message = message;
      setTimeout(() => {
        this.isShow = false;
        this.message = "";
      }, duration);
    }
  }
};
</script>
<style scoped>
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 15px;
  color: #fff;
  border-radius: 5px;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 999;
}
.symbol {
  width: 60px;
  height: 60px;
  position: relative;
  top: 50%;
  left: 50%;
  transform: translateX(-50%);
}

.icon {
  width: 100%;
  height: 100%;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>